package com.umgsai.thread.thread56;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class Main1 {
	static int i = 0;
	static public class MyTask extends TimerTask{

		@Override
		public void run() {
			System.out.println("正常执行：" + i);
		}
	}
	public static void main(String[] args) throws ParseException {
		while (true) {
			i++;
			Timer timer = new Timer();
			MyTask task = new MyTask();
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String dateString = "2016-07-09 22:32:55";
			Date date = sdf.parse(dateString);
			timer.schedule(task, date);
			timer.cancel();
		}
	}
}
